/*
 * Ajax 
 */
function loadUrlToDivContent(url)
{   
    $.ajax({
        url: url,
        async: false,
        data: {
            'readonly':$('#readonly').val(),
            'id_bm1':$('#id_bm1').val()
        },
        type: 'post',
        cache: false,
        success: function(data) {            
            $('#content').html(data);              
        }
    });
}
function danhmucsaveAction(url)
{
    $.ajax({
        url: url,
        async: false,
        data:$('#frm').serialize(),
        type: 'post',
        cache: false,
        success: function(data) {            
            $('#content').html(data);              
        }
    });
}
/*
 * paginator
 */
function paginatorPage(url)
{
    $.ajax({
        url: url,
        async: false,
        data: {
            'paginator':'true',
            'loai':$('#loai').val(),
            'linhvuc':$('#linhvuc').val(),
            'fieldsearch':$('#fieldsearch').val(),
            'textsearch':$('#textsearch').val(),
            'hienthi':$('#hienthi').val()
        },
        type: 'post',
        cache: false,
        success: function(data) {  
            
            $('#content').html(data);              
        }
    });
}
/*
 * Delete
 */
function deleteRow(url)
{
     var ids = $('input[name="selected[]"]').map(function() {
            return this.checked ? this.value : null;
        }).get();
    if (confirm('Bạn có muốn xóa không?')) 
    {
        $.ajax({
            url: url,
            async: false,
            data: {
                'ids':ids
            },
            type: 'post',
            cache: false,
            success: function(data) {  

                $('#content').html(data);              
            }
        });
    }
}
function toggle(source) {
    checkboxes = document.getElementsByName('selected[]');
    for (var i = 0, n = checkboxes.length; i < n; i++) {
        checkboxes[i].checked = source.checked;
    }
}